Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: More Macintosh Toolbox

Previous | Chapter Top | Chapter Contents | Next |

Capturing Components

The Component Manager allows your component to capture another component. When a component is captured, the Component Manager removes the captured component from its list of available components. The FindNextComponent function does not return information about captured components. Also, other applications or clients cannot open or access captured components unless they have previously received a component identifier or component instance for the captured component. The routines described in this section allow your component to capture and uncapture other components.

Typically, your component captures another component when you want to override all or some of the features provided by a component or to provide new features. For example, a component called NewMath might capture a component called OldMath. Suppose the NewMath component provides a new function, DoExponent . Whenever NewMath gets an exponent request, it can handle the request itself. For all other requests, NewMath might call the OldMath component to perform the request.

After capturing a component, your component might choose to target a particular instance of the captured component. For information on targeting a component instance, see "Responding to the Target Request," and "Targeting a Component Instance" .

Use the CaptureComponent function to capture a component. Use the UncaptureComponent function to restore a previously captured component to the search list.

CaptureComponent

The CaptureComponent function allows your component to capture another component. In response to this function, the Component Manager removes the specified component from the search list of components. As a result, applications cannot retrieve information about the captured component or gain access to it. Current clients of the captured component are not affected by this function.

FUNCTION CaptureComponent (capturedComponent: Component;
                                         capturingComponent: Component)
                                         : Component;
capturedComponent
The component identifier of the component to be captured. Your component can obtain this identifier from the FindNextComponent function or from the component registration routines.
capturingComponent
The component identifier of your component. Note that you can use the component instance (appropriately coerced) that your component received in its open request in this parameter.

DESCRIPTION

The CaptureComponent function removes the specified component from the search list of components and returns a new component identifier. Your component can use this new identifier to refer to the captured component. For example, your component can open the captured component by providing this identifier to the OpenComponent  function. Your component must provide this identifier to the UncaptureComponent function to specify the component to be restored to the search list.

If the component specified by the capturedComponent parameter is already captured, the CaptureComponent function returns a component identifier set to NIL .

SEE ALSO

See "Responding to the Target Request" and "Targeting a Component Instance" for information about target requests. For information related to the Component Manager's use of its list of available components, see FindNextComponent for details on the FindNextComponent function and OpenDefaultComponent for details on the OpenDefaultComponent function. See "Registering Components," for details of the component registration routines.

UncaptureComponent

The UncaptureComponent function allows your component to uncapture a previously captured component.

FUNCTION UncaptureComponent (aComponent: Component): OSErr;
aComponent
The component identifier of the component to be uncaptured. Your component obtains this identifier from the CaptureComponent function.

DESCRIPTION

The UncaptureComponent function restores the specified component to the search list of components. Applications can then access the component and retrieve information about the component using Component Manager routines.

RESULT CODES

noErr

0

No error

invalidComponentID

-3000

No component has this component identifier

componentNotCaptured

-3002

This component has not been captured


© 1999 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next